package cz.muni.fi.pa165.musiclibrary.impl.service.auth;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import cz.muni.fi.pa165.musiclibrary.api.service.auth.IUser;

/**
 *
 * @author Maros Kucbel
 * @date 2013-01-22T17:59:37+0100
 */
public final class User implements IUser {
    
    private final String userName;
    
    private final String password;
    
    public User(final String userName, final String password) {
        this.userName = userName;
        this.password = password;
    }

    @Override
    public String getUserName() {
        return userName;
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final User other = (User) obj;
        return new EqualsBuilder()//
                .append(this.getUserName(), other.getUserName())//
                .build();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder()//
                .append(this.getUserName())//
                .build();
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
    }
    
}